package cn.bootx.table.modify.pgsql.index;

import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbTable;
import cn.bootx.table.modify.postgresql.annotation.DbPgSqlIndex;
import cn.bootx.table.modify.postgresql.constants.PgSqlIndexType;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.experimental.FieldNameConstants;

import static cn.bootx.table.modify.pgsql.index.BaseIndexEntity.Fields.*;

/**
 * 复杂索引配置
 * @author xxm
 * @date 2023/6/5
 */
// 普通索引 数据库字段名称
@DbPgSqlIndex(columns = "db_index1",comment = "普通索引-数据库字段",name = "db_index1")
// 普通索引 字段名称方式
@DbPgSqlIndex(fields = dbIndex1,comment = "普通索引-实体类字段",name = "db_index1_field")
// 联合索引
@DbPgSqlIndex(fields = {dbIndex1, index2},comment = "联合索引")
// 全文索引
@DbPgSqlIndex(fields = index4,type = PgSqlIndexType.HASH)
@DbPgSqlIndex(fields = index3, unique = true, comment = "唯一索引")
@DbTable(comment = "复杂索引配置")
@FieldNameConstants
public class BaseIndexEntity {
    private String dbIndex1;

    private String index2;

    @DbColumn("index_3")
    private Long index3;

    @TableField("index_4")
    private String index4;
}
